//
//  RedCoinView.m
//  components
//
//  Created by linzaifei on 2021/8/11.
//

#import "RedCoinView.h"
#import "UIView+category.h"
@implementation RedCoinView

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self setRedCoinView];
    }
    return self;
}

-(void)setRedCoinView{
    
    CGFloat width = CGRectGetWidth([UIApplication sharedApplication].keyWindow.frame);
    UIImageView *fontImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ic_coin_hb_close"]];
    fontImageView.contentMode = UIViewContentModeScaleAspectFit;
    [self addSubview:fontImageView];
    

    fontImageView.translatesAutoresizingMaskIntoConstraints = NO;
    
    
    [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[fontImageView(==w)]" options:0 metrics:@{@"w":@(width/2)} views:@{@"fontImageView":fontImageView}]];
    [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[fontImageView]-0-|" options:0 metrics:0 views:@{@"fontImageView":fontImageView}]];

    [self addConstraint:[NSLayoutConstraint constraintWithItem:fontImageView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]];

   
    
    
    
    

   
    
}

@end

